/* Copyright (C) 2007 Ryan Capote
 * This file is apart of BlueEngine
 * See licsense.txt
 */
#include "utils.h"


namespace BlueEngine
{

    namespace Utilities
    {

         /*
          *  Color
          */
         Color::Color()
         {
              r = 255;
              g = 255;
              b = 255;
              a = 255;
         }

         Color::Color(int r, int g, int b, int a = 255)
         {
              // Red
              if(r > 255) 
                   this->r = 255;
              else
                   this->r = r;

              // Green
              if(g > 255) 
                   this->g = 255;
              else
                   this->g = g;
			
              // Blue
              if(b > 255) 
                   this->b = 255;
              else
                   this->b = b;

              // Alpha
              if(a > 255) 
                   this->a = 255;
              else
                   this->a = a;
	 }


         /*
          *     Coord
          */
         Coord::Coord() :
                 x(0), y(0)
         { }

         Coord::Coord( int x, int y ) :
                 x(x), y(y)
         { }


         /*
          *     Rect
          */
         Rect::Rect()
         {
              this->x = 0; 
              this->y = 0; 
              this->width = 0; 
              this->height = 0;
         }

         Rect::Rect( int x, int y, int w, int h )
         {
              this->x = x; 
              this->y = y; 
              this->width = w; 
              this->height = h;
         }

         bool Rect::isPointInRect( int x, int y )
         {
              if( x >= this->x && x <  ( this->x + this->width )&&
                  y >= this->y && y <  ( this->y + this->height ) )
              {
                   return true;
              }
              else
              {
                   return false;
              }
         }

         bool Rect::isPointInRect( Coord &coord )
         {
             if( coord.x >= this->x && coord.x <  ( this->x + this->width )&&
                 coord.y >= this->y && coord.y <  ( this->y + this->height ) )
             {
                  return true;
             } 
             else
             {
                  return false;
             }
         }

    }

}

